﻿//#define Debug

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Reflection;

namespace HPCloud.Objects.DataAccess.Compute
{
    public class RDPClient
    {
        private string _username = "Administrator";
        private string _password;
        private string _address;

//=============================================================================
/// <summary>
/// 
/// </summary>
//=============================================================================
        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }
//=============================================================================
/// <summary>
/// 
/// </summary>
//=============================================================================
        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }
//=============================================================================
/// <summary>
/// 
/// </summary>
//=============================================================================
        public string Username
        {
            get { return _username; }
            set { _username = value; }
        }       
//=============================================================================
/// <summary>
/// 
/// </summary>
//=============================================================================
        public void LaunchClient()
        {
            ProcessStartInfo startParams = new ProcessStartInfo();
           
            #if DEBUG
                startParams.FileName = @"C:\Projects\HPCloud\CLI\RDPClient\bin\Debug\HPCloud.RDPClient.exe";
            #else

            if (Environment.Is64BitOperatingSystem)
            {                
                startParams.FileName = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\HP\HPCS-Powershell\HPCloud.RDPClient.exe";
            }
            else
                startParams.FileName = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\HP\HPCS-Powershell\HPCloud.RDPClient.exe";
            #endif
                startParams.Arguments = _address + " " + _username + " " + _password.Replace(@"\\r\\n", String.Empty);
            Process.Start(startParams);
        }
    }
}
